package app.server.project.main.service.service;

import cn.hutool.core.lang.intern.InternUtil;
import cn.hutool.core.lang.intern.Interner;
import org.springframework.stereotype.Service;

@Service
public class LockService {
    private Interner<Long> interner = InternUtil.createWeakInterner();
    private Interner<String> stringInterner = InternUtil.createWeakInterner();

    public Long getLock(long userId) {
        return this.interner.intern(userId);
    }

    public String getLock(String lockName) {
        return this.stringInterner.intern(lockName);
    }
}
